
package cn.net.greenet.user.operation;

import cn.net.greenet.common.db_service.BaseDao;

/**
 * 用户操作的策略库(创建、编辑和删除)
 *
 * @author liangdelin
 */
public class UserPolicyBankAction {
    /*
     创建策略日志
     */

    public static void createPolicyBank(String username, String instance, String messageType) {
        try {
            BaseDao baseDao = new BaseDao();
            int row = baseDao.executeUpdate("INSERT INTO useroperation(username,operation_time,`describe`) VALUES(?,?,?)", new Object[]{username, System.currentTimeMillis(), "用户" + username + "在策略类型为：" + messageType + "创建" + instance + "策略仓库"});
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    /*
     编辑策略日志
     */
    public static void editPolicyBank(String username, String instance, String messageType) {
        try {
            BaseDao baseDao = new BaseDao();
            int row = baseDao.executeUpdate("INSERT INTO useroperation(username,operation_time,`describe`) VALUES(?,?,?)", new Object[]{username, System.currentTimeMillis(), "用户" + username + "在策略类型为：" + messageType + "编辑" + instance + "策略仓库"});
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void deletePolicyBank(String username, String instance, String messageType) {
        try {
            BaseDao baseDao = new BaseDao();
            int row = baseDao.executeUpdate("INSERT INTO useroperation(username,operation_time,`describe`) VALUES(?,?,?)", new Object[]{username, System.currentTimeMillis(), "用户" + username + "在策略类型为：" + messageType + "删除" + instance + "策略仓库"});
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
